home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / lib / p4_MD.h < prev    next >
C/C++ Source or Header  |  1992-12-16  |  8KB  |  397 lines

  1.  
  2. /* ------------------ Machine Dependent Definitions ---------------- */
  3. /*
  4.         It is important to maintain the order of many of the 
  5.         definitions in this file.
  6. */
  7.  
  8.  
  9. #ifdef TC_2000_TCMP
  10. #define TC_2000
  11. #define TCMP
  12. #endif
  13.  
  14. #if defined(FX8)  ||  defined(FX2800)  || defined(FX2800_SWITCH)
  15. #define ALLIANT
  16. #endif
  17.  
  18. #if defined(FX2800)  || defined(FX2800_SWITCH)
  19. #define VPRINTF
  20. #endif
  21.  
  22.  
  23. #if defined(DELTA) || defined(IPSC860_SOCKETS)
  24. #define IPSC860
  25. #endif
  26.  
  27. #if defined(NEXT)  || defined(KSR) ||  defined(IPSC860)
  28. #define GLOBAL
  29. #endif
  30.  
  31.  
  32. #if defined(SUN)        || defined(DEC5000)  || \
  33.     defined(NEXT)       || defined(KSR)      || \
  34.     defined(SYMMETRY)   || defined(BALANCE)  || \
  35.     defined(ALLIANT)    || defined(MULTIMAX) ||  defined(CM5) || \
  36.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  37.  
  38. #define P4BSD
  39.  
  40. #endif
  41.  
  42. #if defined(SUN)        || defined(DEC5000)  || \
  43.     defined(NEXT)       || defined(KSR)      || \
  44.     defined(SYMMETRY)   || defined(BALANCE)  || \
  45.     defined(ALLIANT)    || defined(MULTIMAX) || \
  46.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  47.  
  48. #define CAN_DO_SETSOCKOPT
  49.  
  50. #endif
  51.  
  52. #if defined(RS6000)          ||                          \
  53.     defined(IPSC860_SOCKETS) ||                         \
  54.     defined(DELTA)           || defined(TITAN)        || \
  55.     defined(SGI)             || defined(CRAY)         || \
  56.     defined(HP)              || defined(SYMMETRY_PTX)
  57.  
  58. #define CAN_DO_SETSOCKOPT
  59.  
  60. #endif
  61.  
  62.  
  63. #if defined(RS6000)       || \
  64.     defined(IPSC860)      ||                          \
  65.     defined(DELTA)        || defined(TITAN)        || \
  66.     defined(SGI)          || defined(CRAY)         || \
  67.     defined(HP)           || defined(SYMMETRY_PTX)
  68.  
  69. #define P4SYSV
  70.  
  71. #endif
  72.  
  73.  
  74. #ifdef P4SYSV
  75. #define P4_SYSV_SHM_SEGSIZE (1*1024*1024)
  76. #endif
  77.  
  78.  
  79. #ifdef P4SYSV
  80. #define SIGNAL_P4 sigset
  81. #else
  82. #define SIGNAL_P4 signal
  83. #endif
  84.  
  85.  
  86. #ifndef P4BOOL
  87. #define P4BOOL int
  88. #endif
  89.  
  90. #if defined(BALANCE)  ||  defined(FX8)
  91. #define P4VOID int
  92. #else 
  93. #define P4VOID void
  94. #endif
  95.  
  96.  
  97. /*------------------ Encore Multimax ---------------------- */
  98.  
  99.  
  100. #if defined(MULTIMAX)
  101.  
  102. #include <parallel.h>
  103.  
  104. #ifndef LINT
  105. typedef LOCK *MD_lock_t;
  106. #define MD_lock_init(l)  *(l) = spin_create(PAR_UNLOCKED);
  107. #define MD_lock(l)       spin_lock(*(l));
  108. #define MD_unlock(l)     spin_unlock(*(l));
  109. #endif
  110.  
  111. #define GLOBMEMSIZE  (2*1024*1024)
  112. #define CAN_DO_SOCKET_MSGS
  113. #define CAN_DO_XDR
  114. #define CAN_DO_SHMEM_MSGS
  115. #define P4_MAX_MSG_QUEUES 64
  116.  
  117. #endif
  118.  
  119.  
  120. /*------------------ Sequent Balance or Symmetry ---------------------- */
  121.  
  122.  
  123. #if !defined(SYMMETRY) && !defined(SYMMETRY_PTX) && !defined(BALANCE)
  124. #define CAN_HANDLE_SIGSEGV
  125. #endif
  126.  
  127. #if defined(BALANCE) || defined(SYMMETRY) || defined(SYMMETRY_PTX)
  128.  
  129. #include <parallel/parallel.h>
  130.  
  131. typedef slock_t MD_lock_t;
  132.  
  133. #ifndef LINT
  134. #define MD_lock_init(l)  s_init_lock(l);
  135. #define MD_lock(l)       s_lock(l);
  136. #define MD_unlock(l)     s_unlock(l);
  137. #endif
  138. extern char *shmalloc();
  139. #if defined(SYMMETRY_PTX)
  140. extern P4VOID *malloc();
  141. #else
  142. extern char *malloc();
  143. #endif
  144.  
  145. #define GLOBMEMSIZE  (1*1024*1024)
  146. #define CAN_DO_SOCKET_MSGS
  147. #define CAN_DO_XDR
  148. #define CAN_DO_SHMEM_MSGS
  149. #define P4_MAX_MSG_QUEUES 64
  150.  
  151. #endif
  152.  
  153. /*---------------------------- Alliant -------------------------------- */
  154. #if defined(ALLIANT)
  155.  
  156. typedef char MD_lock_t;
  157.  
  158. #ifndef LINT
  159. #define MD_lock_init(l)  initialize_lock(l);
  160. #define MD_lock(l)       lock(l);
  161. #define MD_unlock(l)     unlock(l);
  162. #endif
  163. extern char *valloc();
  164.  
  165. #ifdef FX8
  166. #define GLOBMEMSIZE  (2*1024*1024)    
  167. #else
  168. #define GLOBMEMSIZE  (8*1024*1024)    /* Lots of memory ... use it! */
  169. #endif
  170.  
  171. #define USE_XX_SHMALLOC          /* If not defined uses dumb xx_malloc */
  172.  
  173. #define CAN_DO_SOCKET_MSGS
  174. #define CAN_DO_XDR
  175. #define CAN_DO_SHMEM_MSGS
  176. #define P4_MAX_MSG_QUEUES 64
  177.  
  178. #endif
  179.  
  180. #if defined(FX2800_SWITCH)
  181. #include "sw.h"
  182. #define CAN_DO_SWITCH_MSGS
  183. #endif
  184.  
  185.  
  186. /*---------------------------- Uniprocessors -------------------------- */
  187.  
  188. #if defined(CRAY) || defined(NEXT)
  189. #define GLOBMEMSIZE  (1*1024*1024)
  190. #define CAN_DO_SOCKET_MSGS
  191. #define CAN_DO_XDR
  192. #define P4_MAX_MSG_QUEUES 1
  193. typedef int MD_lock_t;
  194. #define MD_lock_init(l)
  195. #define MD_lock(l)
  196. #define MD_unlock(l)
  197. #endif
  198.  
  199. #if defined(SUN) ||  defined(DEC5000)      \
  200.     || defined(RS6000) || defined(IBM3090) \
  201.     || defined(TITAN) || defined(SGI)      \
  202.     || defined(HP)
  203.  
  204. #if defined(SYSV_IPC)
  205. #define GLOBMEMSIZE  (1*1024*1024)
  206. #define CAN_DO_SOCKET_MSGS
  207. #define CAN_DO_XDR
  208. #define CAN_DO_SHMEM_MSGS
  209. #define USE_XX_SHMALLOC
  210. #define P4_MAX_MSG_QUEUES 4
  211. #define P4_MAX_SYSV_SHMIDS  8
  212. #define P4_MAX_SYSV_SEMIDS  8
  213.  
  214. typedef struct { int semid;  int semnum; }   MD_lock_t;
  215.  
  216. #include <sys/ipc.h>
  217. #include <sys/shm.h>
  218. #include <sys/sem.h>
  219.  
  220. static struct sembuf sem_lock[1] = {
  221.     0, -1, 0
  222. };
  223. static struct sembuf sem_unlock[1] = {
  224.     0, 1, 0
  225. };
  226.  
  227. #else
  228.  
  229. #define GLOBMEMSIZE  (1*1024*1024)
  230. #define CAN_DO_SOCKET_MSGS
  231. #define CAN_DO_XDR
  232. #define P4_MAX_MSG_QUEUES 1
  233. typedef int MD_lock_t;
  234. #define MD_lock_init(l)
  235. #define MD_lock(l)
  236. #define MD_unlock(l)
  237.  
  238. #endif
  239. #endif
  240.  
  241.  
  242. /* following is for POSIX std versions of Unix */
  243. #if defined(SGI)  ||  defined(RS6000)
  244. #include <unistd.h>
  245. #endif
  246.  
  247.  
  248.  
  249. /*---------------------------- IPSC860 Cube --------------------------- */
  250.  
  251. #if defined(IPSC860)
  252.  
  253. #    if defined(DELTA)
  254. #        define P4_MAX_CUBE_MSGS_OUT 5
  255. #    else
  256. #        define P4_MAX_CUBE_MSGS_OUT 5
  257. #    endif
  258.  
  259. #define MD_cube_send  MD_i860_send
  260. #define MD_cube_recv  MD_i860_recv
  261. #define MD_cube_msgs_available  MD_i860_msgs_available
  262.  
  263. typedef int MD_lock_t;
  264.  
  265. #ifndef LINT
  266. #define MD_lock_init(l)
  267. #define MD_lock(l)
  268. #define MD_unlock(l)
  269. #endif
  270.  
  271. #define GLOBMEMSIZE  (1*1024*1024)
  272. #define CAN_DO_CUBE_MSGS
  273. #define P4_MAX_MSG_QUEUES 1
  274.  
  275. #define ALL_NODES -1
  276.  
  277. #define NO_TYPE_IPSC     0 
  278. #define ACK_REQUEST_IPSC 1
  279. #define ACK_REPLY_IPSC   2
  280. #define ANY_P4TYPE_IPSC    0x80000007
  281.  
  282. #define NODE_PID 0
  283.  
  284. #if defined(IPSC860_SOCKETS)
  285. #define CAN_DO_SOCKET_MSGS
  286. /*****
  287. #include <CMC/sys/types.h>
  288. #include <CMC/sys/socket.h>
  289. #include <CMC/netinet/in.h>
  290. #include <CMC/netdb.h>
  291. *****/
  292. #include <CMC/ntoh.h>
  293. #endif
  294.  
  295. #endif    
  296.  
  297. /*---------------------------- CM-5 --------------------------- */
  298.  
  299. #if defined(CM5)
  300.  
  301. #include <cm/cmmd.h>
  302. #include <cm/cmmd-io.h>
  303.  
  304. typedef int MD_lock_t;
  305.  
  306. #ifndef LINT
  307. #define MD_lock_init(l)
  308. #define MD_lock(l)
  309. #define MD_unlock(l)
  310. #endif
  311.  
  312. #define GLOBMEMSIZE  (1*1024*1024)
  313. #define CAN_DO_CUBE_MSGS
  314. #define P4_MAX_MSG_QUEUES 1
  315.  
  316. #define NO_TYPE_CM5     0 
  317. #define ACK_REQUEST_CM5 1
  318. #define ACK_REPLY_CM5   2
  319. #define ANY_P4TYPE_CM5    CMMD_ANY_TAG
  320.  
  321. #define MD_cube_send  MD_CM5_send
  322. #define MD_cube_recv  MD_CM5_recv
  323. #define MD_cube_msgs_available  MD_CM5_msgs_available
  324.  
  325. #endif    
  326.  
  327. /*----------------   KSR             -------------------------*/
  328. #if defined(KSR)
  329. #include <sys/mman.h>
  330. #include <pthread.h>
  331.  
  332. #define USE_XX_SHMALLOC
  333. #define GLOBMEMSIZE  (8*1024*1024)
  334. #define P4_MAX_MSG_QUEUES 32
  335. #define CAN_DO_SOCKET_MSGS
  336. #define CAN_DO_XDR
  337. #define CAN_DO_SHMEM_MSGS
  338.  
  339. #define MD_lock_t       msemaphore
  340. #define MD_lock_init(l) msem_init(l, MSEM_UNLOCKED)
  341. #define MD_lock(l)      msem_lock(l, 0)
  342. #define MD_unlock(l )   msem_unlock(l, 0)
  343.  
  344. #endif
  345.  
  346.  
  347.  
  348. /*------------------ Butterfly TC-2000/GP-1000 -------------- */
  349. #if defined(TC_2000)  ||  defined(GP_1000)
  350. #include <mach.h>    
  351. #include <sys/cluster.h>
  352. #include <sys/kern_return.h>
  353. #include <heap.h>
  354.  
  355. char *xx_malloc();
  356. P4VOID MD_malloc_hint();
  357.  
  358. #ifdef MALLOC_STATS
  359. static unsigned int allocated = 0;
  360. #endif
  361.  
  362. #define MD_lock_t       int
  363. #ifndef LINT
  364. #define MD_lock_init(l) simple_unlock(l)
  365. #define MD_lock(l)      simple_lock(l)
  366. #define MD_unlock(l)    simple_unlock(l)
  367. #endif
  368.  
  369. #define GLOBMEMSIZE  (1*1024*1024)
  370. #define CAN_DO_SOCKET_MSGS
  371. #define CAN_DO_XDR
  372. #define CAN_DO_SHMEM_MSGS
  373. #define P4_MAX_MSG_QUEUES 128
  374.  
  375. #endif
  376.  
  377. #ifdef TCMP
  378. #define CAN_DO_TCMP_MSGS
  379. /* #include </Net/sparky/sparky1/lusk/lepido/tcmp/tcmp.h> */
  380. #include </usr/bbnm/tcmp/tcmp.h>
  381. #endif
  382.  
  383. /* ----------------- Can be made machine dependent -------------------*/
  384.  
  385. typedef unsigned long p4_usc_time_t;
  386.  
  387.  
  388. extern P4VOID exit();
  389.  
  390. #define P4_MAXPROCS 128
  391.  
  392. #ifndef LINT
  393. #define p4_malloc malloc
  394. #define p4_free free
  395. #define p4_clock MD_clock
  396. #endif
  397.